<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css" />
    <!--企业logo组件-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/bullet.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/jquery.Jcrop.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/jquery.Jcrop.min.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>合同管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页  <span class="c-gray en">&gt;</span> 合同管理 <span class="c-gray en">&gt;</span> 立项申请 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
<form class="ml-20 mr-20" id="form-member-add"  method="post" style="position: relative">
    <div class=" pd-5 bg-1 bk-gray mt-10" id="interpolation">
        <script id="interpolationtmpl" type="text/x-dot-template">
            <div class="va-m pl-10 lh-50 f-17 f-16">
                <strong>立项申请</strong>
            </div>
            <div class="pl-10 lh-30 mb-10">
                <div class="row pro_inpt ml-10">
                    <label class="form-label f-l"><span class="c-red">*</span>申请主题：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        {{? it.appr_theme==undefined}}
                        <input type="text" class="input-text radius"  name="username" id="username" value=""   placeholder="请输入立项申请主题" maxlength="30">
                        {{??}}
                        <input type="text" class="input-text radius"  name="username" id="username" value="{{=it.appr_theme}}"   placeholder="请输入立项申请主题" maxlength="30">
                        {{ }}}
                    </div>
                </div>
                <span class="ml-40">申请编号: <span id="coding">{{=it.mobile}}</span></span>
                <span class="ml-40">申请日期: <span id="date_er">{{=it.date}}</span></span>
            </div>
        </script>
    </div>
    <div class=" pd-5 bg-1 bk-gray mt-10 f-16"id="kehu_er">
        <script id="kehu_bob" type="text/x-dot-template">
                <div class="va-m pl-10 lh-50 f-17">
                    <strong>客户基本信息</strong>
                </div>
                <table class="table_li ml-10" >
                    <thead class="text-l">
                    <tr>
                        <td class="col-3-1">
                            <span>客户名称:<span>{{=it.customer_name}}</span></span>
                        </td>
                        <td class="col-3-1">
                            <label class="form-label f-l"><span class="c-red">*</span>采购商简述：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                {{? it.purchase_goods_intro==undefined}}
                                <input type="text" class="input-text radius"  name="inform" id="inform"  placeholder="工程基建类主材及辅材">
                                {{??}}
                                <input type="text" class="input-text radius"  name="inform" id="inform" value="{{=it.purchase_goods_intro}}"  placeholder="工程基建类主材及辅材">
                                {{ }}}
                            </div>
                        </td>
                        <td class="col-3-1">
                            <span>老系统合同号:
                                {{? it.old_sys_contract_num==undefined}}
                                <span></span>
                                {{??}}
                                <span>{{=it.old_sys_contract_num}}</span>
                                {{ }}}
                               </span>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" class="col-1-1">
                            <span style="width: 50px;">客户简介: <span >{{=it.introduct}}</span></span>
                        </td>
                    </tr>
                    <tr >
                        <td class="col-3-1">
                            <span>客户类型: <span>{{=it.customer_type}}</span></span>
                        </td>
                        <td colspan="2" class="col-3-2">
                            <span> 合同类型: <span>{{=it.customer_type}}</span></span>
                        </td>
                    </tr>
                    <tr >
                        <td class="col-3-1">
                            <span>客户联系人: <span class="text-overflow" style="width: 10px">{{=it.linkman}}</span></span>
                        </td>
                        <td class="col-3-1">
                            <label class="form-label f-l"><span class="c-red">*</span>邮箱：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                {{? it.customer_email==undefined}}
                                <input type="text" class="input-text radius"  name="email" id="email"   placeholder="@xxx.com">
                                {{??}}
                                <input type="text" class="input-text radius"  name="email" id="email" value="{{=it.customer_email}}"   placeholder="@xxx.com">
                                {{ }}}
                            </div>
                        </td>
                        <td class="col-3-1">
                            <span>客户地址: <span>{{=it.address}}</span></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-3-1">
                            <span>固定电话: <span>{{=it.office_phone}}</span></span>
                        </td>
                        <td class="col-3-1">
                            <span>手机号码: <span class="text-overflow" style="width: 10px">{{=it.mobile}}</span></span>
                        </td>
                        <td class="col-3-1">
                            <span>职位: <span>{{=it.duty}}</span></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-3-1">
                            <span>授权收货人: <span  class="consignee_name">{{=it.consignee_name}}</span></span>
                        </td>
                        <!--<td width="70">-->
                            <!--<a onclick="more_add('授权收货人','takeover.html','1000','600','310')" class="c-blue">查看更多 >> </a>-->
                        <!--</td>-->
                    </tr>
                    </thead>
                </table>
                <div class="line mt-10"></div>
                <div class="cl mt-10">
                    <table class="table-hover table_li ml-10 sc_pic f-l" style="width: 40%;">
                        <thead class="">
                        <tr >
                            <td width="30">
                                <span>客户资质:</span>
                            </td>
                            <td width="50">
                                <span>企业营业执照</span>
                            </td>
                            <td width="20">
                                <span>有</span>
                            </td>
                            <td>
                                <div class="ceshi pic_up">
                                    <img title="" width="50" height="50" src="{{=it.group_business_license_addr}}" class="myImg" class="mr-10">
                                </div>
                                <div class="pic_up_btn">
                                    <input value="{{=it.group_business_license_addr_short}}" id="fileUp1" style="display: none">
                                    <input type="file" class="fileUp"  onchange="putDataToPage(event,this)"  style="display: none">
                                    </input>
                                    <a onclick="addBtn(this)"><span >上传</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr >
                            <td width="30">
                            </td>
                            <td width="50">
                                <span >企业开户许可证</span>
                            </td>
                            <td width="20">
                                <span>有</span>
                            </td>
                            <td width="70">
                                <div class="ceshi pic_up">
                                    <img title="" width="50" height="50" src="{{=it.group_opening_account_addr}}" class="myImg" class="mr-10">
                                </div>
                                <div class="pic_up_btn">
                                    <input value="{{=it.group_opening_account_addr_short}}" id="fileUp2" style="display: none">
                                    <input type="file" class="fileUp"  onchange="putDataToPage(event,this)"  style="display: none">
                                    <a onclick="addBtn(this)"><span >上传</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr >
                            <td width="30">
                            </td>
                            <td width="50">
                                <span>企业法人身份证</span>
                            </td>
                            <td width="20">
                                <span>有</span>
                            </td>
                            <td width="70">
                                <div class="ceshi pic_up">
                                    <img title="" width="50" height="50" src="{{=it.group_IDcard_url1}}" class="myImg" class="mr-10">
                                </div>
                                <div class="pic_up_btn">
                                    <input value="{{=it.group_IDcard_url1_short}}" id="fileUp3" style="display: none">
                                    <input type="file" class="fileUp"  onchange="putDataToPage(event,this)" multiple="multiple" style="display: none">
                                    <a onclick="addBtn(this)"><span>上传</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="30">
                            </td>
                            <td width="50">
                                <span>委托授权书</span>
                            </td>
                            <td width="20">
                                <span>有</span>
                            </td>
                            <td width="70">
                                <div class="ceshi pic_up">
                                    <img title="" width="50" height="50" src="{{=it.group_loa}}" class="myImg" class="mr-10">
                                </div>
                                <div class="pic_up_btn">
                                    <input value="{{=it.group_loa_short}}" id="fileUp4" style="display: none">
                                    <input type="file" class="fileUp" onchange="putDataToPage(event,this)" style="display: none">
                                    <a onclick="addBtn(this)"><span>上传</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="30">
                            </td>
                            <td width="50">
                                <span>企业logo</span>
                            </td>
                            <td width="20">
                                <span>有</span>
                            </td>
                            <td width="70">
                                <div class="ceshi pic_up">
                                    <img title="" width="50" height="50" src="{{=it.logo}}" class="myImg" id="fileUp5url" class="mr-10">
                                </div>
                                <div class="pic_up_btn">
                                    <input value="{{=it.logo}}" id="fileUp5" style="display: none">
                                    <a class="logoingmer" onclick="logodata(1)"><span>上传</span></a>
                                </div>
                            </td>
                        </tr>
                        </thead>
                    </table>
                    <div class="row f-l table_w50 ml-20 mt-20" >
                        <label class="f-l">备注信息：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            {{? it.customer_linkman==undefined}}
                            <textarea name="abstract" class="textarea"  readonly="readonly" title="不可输入">空</textarea>
                            {{??}}
                            <textarea name="abstract" class="textarea"  readonly="readonly" title="不可输入">{{=it.customer_linkman}}</textarea>
                            {{ }}}
                        </div>
                    </div>
                </div>
            </script>
    </div>
    <div class="bg-1 bk-gray" style="height: 50px;">
        <div class="pl-10 lh-30 pt-10">
            <span >营销主管: <span id="groupId_txt"></span></span>
            <span class="ml-40">客户归属: <span id="belGroupId"></span></span>
            <div class="row ml-10 f-r mr-50">
                <label class="form-label  f-l"><span class="c-red">*</span>运营经理：</label>
                <div class="formControls col-xs-8 f-r" style="position: relative">
                    <input type="text" class="input-text radius"id="manager" name="moli" oninput="myFunction()" autocomplete="off"   placeholder="请选择运营经理">
                    <div id="myDiv" style="display:none;"></div>
                    <ul class="relation radius guanlian" id="tuan" >
                        <li>无数据</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class=" pd-5 bg-1 bk-gray mt-10 mb-50" id="">
            <div class="va-m pl-10 lh-50 f-17 f-16">
                <strong>签约信息</strong>
            </div>
            <div class="pl-10 lh-30 mb-10">
                <div class="row ml-10">
                    <label class="form-label f-l" style="line-height: 2"><span class="c-red">*</span>价格体系：</label>
                    <select id="daku" onclick="discount()" class="select radius" name="brandclass" size="1" style="width:70%; height: 30px;" onchange="discountHide(value)">
                        <option value="0">品类折扣价</option>
                    </select>
                </div>
            </div>
            <table class="table table-border table-bordered table-striped table-hover table-bg table-sort" id="sign" >
                <thead class="">
                <tr >
                    <td width="150">
                        <span>品类选择</span>
                    </td>
                    <td width="50">
                        <span>品类折扣率</span>
                    </td>
                    <td width="70">
                        输入折扣率
                    </td>
                    <td width="70">
                        <a  class="c-blue" onclick="commodity_add('品类折扣率添加','contr_detail22.html','1600','655')">添加</a>
                    </td>
                </tr>
                </thead>
                <thead id="bootbrsli">
                    <tr>
                        <td>1</td>
                        <td>1</td>
                        <td>1</td>
                        <td>1</td>
                    </tr>
                </thead>
            </table>
        <div id="qian_lsit">
        <script id="qian_bob" type="text/x-dot-template">
            <div class="pl-10 lh-30 mb-10 mt-10">
                <div class="row ml-10 f-l" style="width: 50%">
                    <label class="form-label f-l" style="line-height: 2"><span class="c-red">*</span>运费政策：</label>
                    <select class="select radius" name="brandclass" size="1" style="width:50%; height: 30px;" id="expressPolicy">
                        {{? it.express_policy=="0"}}
                        <!--<option value="" selected>请选择运费政策</option>-->
                        <option value="0">全免费</option>
                        <option value="1" id="yun_f">3000元以上免费</option>
                        {{??}}
                        <!--<option value="" selected>请选择运费政策</option>-->
                        <option value="1" id="yun_f">3000元以上免费</option>
                        <option value="0">全免费</option>
                        {{ }}}
                    </select>
                </div>
            </div>
            <div class="pl-10 lh-30 mb-10">
                <span>结算方式: <span>{{=it.balance_way}}</span></span>
                <span class="ml-40">结算日期: <span>{{=it.balance_day}}日</span></span>
                {{? it.balance_remark == null}}
                <span class="ml-40">结算备注: <span> 空</span></span>
                {{??}}
                <span class="ml-40">结算备注: <span>{{=it.balance_remark}}</span></span>
                {{?}}
            </div>
            <div class="pl-10 lh-30 mb-10">
                <span>授信额度: <span>{{=it.credit}}</span></span>
                <span class="ml-40">账期时间: <span>{{=it.payment_date}}个月账期</span></span>
            </div>
        </script>
        </div>
    </div>
    <div class="text-c">
        <input type="submit" type="button" class="btn btn-secondary radius size-S" value="提&nbsp;&nbsp;交">
        <input class="btn btn-secondary radius size-S ml-10 " style="width:75px" readonly="readonly" onclick="Preservation()" value="保&nbsp;&nbsp;存">
        <!--<input name="" onclick="cancel()"  type="button" class="btn radius size-S ml-10" value="取&nbsp;&nbsp;消">-->
    </div>
        <div class="mt-20 text-c mb-20">
            鑫方盛电子商务股份有限公司提供支持
        </div>
</form>
    <!--企业logo-->
    <div class="modal-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
    <div class="modal-dialog_lsit" style="width:880px;">
        <div class="modal-content radius">
            <div class="modal-header">
                <h3 class="modal-title">企业logo编辑</h3>
                <a onclick="logodata(2)" class="close" data-dismiss="modal" aria-hidden="true" href="javascript:;">×</a>
            </div>
            <div class="modal-body modal-center">
                <div class="main">
                    <div class="mainLeft" align="center">
                        <span>要求：请使用真实企业图片，图片格式支持JPG,JPEG,GIF,PNG，支持5M 以内的图片</span>
                        <div class="background">
                            <form name="form" id="uploadImgForm" class="form-horizontal" method="post" enctype="multipart/form-data">
                                <div class="modal-body text-center">
                                    <div class="zxx_main_con">
                                        <div class="zxx_test_list">
                                            <a href="javascript:;" class="file"  style="background-color: #4A90E2; border-color: #4A90E2;color: #fff;margin-right: -37px;cursor:pointer;"><input class="photo-file" style="cursor:pointer;" type="file" name="file" id="fcupload" onchange="readURL(this);" />选择图片</a>
                                            <input type="hidden" name="isNeetCut" value="10">
                                            <img id = "faceId" src="${pageContext.request.contextPath}/static/img/1.jpg" class="jcrop-preview" width="500">
                                            <!-- 图片长宽高隐藏域 -->
                                            <input type="hidden" id="x" name="x" />
                                            <input type="hidden" id="y" name="y" />
                                            <input type="hidden" id="w" name="w" />
                                            <input type="hidden" id="h" name="h" />
                                            <input type="hidden" id="boundx" name="boundx" >
                                            <input type="hidden" id="boundy" name="boundy" >
                                        </div>
                                    </div>
                                </div>

                            </form>
                        </div>
                    </div>
                    <div class="mainRight" align="center">
                        <span class="effect" style="margin-right: -32px;">效果预览</span><br>
                        <span class="px" style="margin-right: -32px;">100*100像素</span>
                        <div class="background" style="margin-right: 100px;">
                            <div id = "preview_box">
                                <img id = "lookId" src="../../img/adminImg.png" class="jcrop-preview">
                            </div>

                        </div>
                        <input type="button" id="save" style="background-color: #4A90E2; border-color: #4A90E2;color: #fff;margin-right: -37px;cursor:pointer;" value="确定上传" class="selectPic">
                    </div>
                    <div style="clear:both"></div>
                </div>
            </div>

        </div>
    </div>
    </div>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<!--<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<!--企业logo组件-->
<script src="../../ht-js/contract/jquery-form.js?rev=@@hash"></script>
<script src="../../ht-js/contract/jquery.Jcrop.js?rev=@@hash"></script>
<!--<script src="../../ht-js/project/jquery-validate.js?rev=@@hash"></script>-->
<script src="../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/Project.js?rev=@@hash"></script>
<script>
    // 未反 备注信息 合同类型 固定电话 授权收货人 客户归属 营销主管
    //查看更多
    function cancel() {
        window.history.back(-1);
    }
    /*var customerId=getQueryString('customerId');
         customerCode=getQueryString('id');
        contract_num=getQueryString('contract_num');*/
    var customerCode=getQueryString('id'),
        customerId=getQueryString('customerId'),
        contractID=getQueryString('contractID');
    function more_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    //品类折扣率添加
    /*function commodity_add(title,url,w,h){
        layer_show(title,url+'?customerId='+customerId+'&id='+customerCode,w,h);
    }*/
    function commodity_add(title, url) {
        sessionStorage.setItem("id",customerCode);
        sessionStorage.setItem("customerId",customerId);
        sessionStorage.setItem("contractID",contractID);
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }
    web.loadMyk();
    //品类折扣率列表初始化
    Reappearance()
    //运营经理关联
    function myFunction(){
        var manager=$("#manager").val();
        var user_data = {
            keywords:manager,
        }
        var succCallBack = function (data, status, response) {
            console.log(data)
            if(data.errorCode=="0"){
                    var jsonObj =data.userList;
                    if(jsonObj==""){
                        $("#tuan").html("<li>无数据</li> ");
                    }else {
                        console.log(jsonObj)
                        var optionstring = "";
                        for (var  i= 0; i < jsonObj.length; i++) {
                            optionstring += "<li onclick='relation("+ jsonObj[i].USER_ID+",\""+jsonObj[i].NAME+"\")' data-align=\"" + jsonObj[i].ROLE_ID + "\" > " + jsonObj[i].NAME + "</li>";
                        }
                        $("#tuan").html(optionstring);
                    }
            }else{
                $("#tuan").html("<li>无数据</li> ");
            }
        }
         web.doAjax(root.inter.getOperationManagerByParam,'post',user_data, succCallBack);
    }
    //运营经理获取光标
    $("#manager").focus(function () {
        $("#tuan").show()
    });
    $(document).bind("click",function(e){
        //id为menu的是菜单，id为open的是打开菜单的按钮
        if($(e.target).closest("#tuan").length == 0 && $(e.target).closest("#manager").length == 0){
            //点击id为menu之外且id不是不是open，则触发
            $("#tuan").hide()
        }
    })
    function relation(id,ce) {
        $("#manager").val(ce).text(id)
        $("#tuan").hide()
        console.log($("#manager").text())
    }
    //formdata上传图片公用方法
    //触发事件
    function addBtn(cen) {
         $(cen).prev().trigger('click');
    }
    var formData = new FormData();
    // 提交上传图片
    function getupfilerul(can,e){
        console.log(can)
        console.log($("#fileUp1").val)
        var formData = new FormData();
        formData.append('file',$(can)[0].files[0]);
        // formData.append('file',$("#fileUp").files);
        console.log($(can)[0].files[0])
        console.log(formData)
        $.ajax({
            url: root.inter.imgUpload,
            // url:'http://192.168.65.115:8080/contract/approval/imgNewUpload.jhtml',
            cache: false,  //禁用缓存
            type: "POST",
            // 告诉jQuery不要去处理发送的数据
            processData : false,
            // 告诉jQuery不要去设置Content-Type请求头
            contentType : false,
            data: formData,
            success: function (data) {
                // if(data.errorCode==0){
                for(var i=0; i<data.length; i++){
                    $(can).prev().val(data[0].reletivePath)
                }
                    // $(can).prev().val(data[0].reletivePath)
                // }
                console.log(data)
            }
        })
    }
    // 上传图片返现
    function putDataToPage(e,can) {
        console.log($("#intro").val())
        for(var i = 0; i < e.target.files.length; i++) {
            var file = e.target.files.item(i);
            if(!(/^image\/.*$/i.test(file.type))) {
                continue; //不是图片 就跳出这一次循环
            }
            //实例化FileReader API
            var freader = new FileReader();
            freader.readAsDataURL(file);
            console.log(e.path)
            console.log(can)
            freader.onload = function (e) {
                console.log(can)
                $(can).parent().prev().children().attr("src", e.target.result);
                console.log(e)
                $(can).next().text('更新')
                getupfilerul(can,e)
            }
        }
        formData.append('file', $(can)[0].files[0]);
    }
    // 企业logo
    /* jcrop对象，全局变量方便操作 */
    var api = null;
    /* 原图宽度 */
    var boundx;
    /* 原图高度 */
    var boundy;
    /* 选择图片事件 */
    function readURL(URL){
        var reader = new FileReader();
        reader.readAsDataURL(URL.files[0]);
        reader.onload = function(e){
            $("#faceId").removeAttr("src");
            $("#lookId").removeAttr("src");
            $("#faceId").attr("src",e.target.result);
            $("#lookId").attr("src",e.target.result);
            $("#faceId").Jcrop({
                setSelect: [ 20, 20, 200, 200 ],
                onChange: showPreview,
                onSelect: showPreview,
                aspectRatio: 1,
                boxWidth:600
            },function(){
                // Use the API to get the real image size
                //使用API来获得真实的图像大小
                var bounds = this.getBounds();
                boundx = bounds[0];
                boundy = bounds[1];
                // Store the API in the jcrop_api variable
                //jcrop_api变量中存储API
                api = this;

                $("#boundx").val(boundx);
                $("#boundy").val(boundy);

            });
        };
        /* 移除jcrop */
        if (api != undefined) {
            api.destroy();
        }
        //简单的事件处理程序，响应自onChange,onSelect事件，按照上面的Jcrop调用
        function showPreview(coords){
            /* 设置剪切参数 */
            $("#x").val(coords.x);
            $("#y").val(coords.y);
            $("#w").val(coords.w);
            $("#h").val(coords.h);
            if(parseInt(coords.w) > 0){
                //计算预览区域图片缩放的比例，通过计算显示区域的宽度(与高度)与剪裁的宽度(与高度)之比得到
                var rx = $("#preview_box").width() / coords.w;
                var ry = $("#preview_box").height() / coords.h;
                $("#lookId").show()
                $("#lookId").css({
                    width:Math.round(rx * $("#faceId").width()) + "px",    //预览图片宽度为计算比例值与原图片宽度的乘积
                    height:Math.round(rx * $("#faceId").height()) + "px",  //预览图片高度为计算比例值与原图片高度的乘积
                    marginLeft:"-" + Math.round(rx * coords.x) + "px",
                    marginTop:"-" + Math.round(ry * coords.y) + "px"
                });
            }
        }
    }
    $('#save').click(function(){
        $('#uploadImgForm').ajaxSubmit({
            url:'https://'+ window.location.host +'/api/admin/abaseservice/upload',
            type:"post",  //提交方式
            success:function (data) {
                $('.modal-dialog').hide()
                $('#fileUp5url').attr("src", data[0].fullPath);
                $('#fileUp5').val(data[0].fullPath)
                $('#logoingmer').text('更新')
                api.destroy();
                $("#faceId").hide()
                $("#lookId").hide()
                if (data[0].errorCode == 0) {
                    layer.msg('上传成功!', {icon: 6,time:1000});
                }else {
                    layer.msg('上传失败!', {icon: 5,time:1000});
                }

            }
        })
    })
    // 显示隐藏企业logo弹框
    function logodata(data) {
        $("#faceId").removeAttr("src");
        $("#lookId").attr("src","../../img/adminImg.png");
        $("#lookId").removeAttr("style");
        $("input[name='file']").val("");
        // var container = $('#form-member-add');
        document.documentElement.scrollTop = 0;
        // $(container).scrollTop(0);
        if(data==1){
            $('.modal-dialog').show()
            return false
        }{
           $('.modal-dialog').hide()
            api.destroy();
            $("#faceId").hide()
            $("#lookId").hide()

        }
    }

</script>
</body>
</html>